package com.chinasi.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.caland.framework.core.page.Pager;
import com.chinasi.dao.BidIntegrationDao;
import com.chinasi.model.BidExpert;
import com.chinasi.model.BidIntegration;
import com.chinasi.model.ConsultBasic;
import com.chinasi.model.ExpertBasic;
import com.chinasi.model.IntegratorBasic;
import com.chinasi.service.BidIntegrationService;

@Service
public class BidIntegrationServiceImpl implements BidIntegrationService {

	/**
	 * BidIntegrationDAO
	 */
	@Autowired
	private BidIntegrationDao bidIntegrationDao;
	
	@Override
	public Pager findRelationBid(String inteCode, int currentPage) {
		BidIntegration searchBean = new BidIntegration();
		searchBean.setInteCode(inteCode);
		Pager pager = new Pager(bidIntegrationDao.getTotalCount(searchBean),currentPage);
		pager.setData(bidIntegrationDao.findRelationBid(searchBean, pager));
		return pager;
	}
	
	@Override
	public Pager findRelationAgency(IntegratorBasic integrator, int currentPage) {
		Pager pager = new Pager(bidIntegrationDao.getRelationAgencyTotalCount(integrator),currentPage);
		pager.setData(bidIntegrationDao.findRelationAgency(integrator,pager));
		return pager;
	}

	@Override
	public Pager findRelationConsult(IntegratorBasic integrator, int currentPage) {
		Pager pager = new Pager(bidIntegrationDao.getRelationConsultTotalCount(integrator),currentPage);
		pager.setData(bidIntegrationDao.findRelationConsult(integrator,pager));
		return pager;
	}

	@Override
	public Pager findRelationConsumer(IntegratorBasic integrator, int currentPage) {
		Pager pager = new Pager(bidIntegrationDao.getRelationConsumerTotalCount(integrator),currentPage);
		pager.setData(bidIntegrationDao.findRelationConsumer(integrator,pager));
		return pager;
	}

	@Override
	public Pager findRelationSupervision(IntegratorBasic integrator, int currentPage) {
		Pager pager = new Pager(bidIntegrationDao.getRelationSupervisionTotalCount(integrator),currentPage);
		pager.setData(bidIntegrationDao.findRelationSupervision(integrator,pager));
		return pager;
	}

	@Override
	public Pager findRelationExpert(IntegratorBasic integrator, int currentPage) {
		Pager pager = new Pager(bidIntegrationDao.getRelationExpertTotalCount(integrator),currentPage);
		pager.setData(bidIntegrationDao.findRelationExpert(integrator,pager));
		return pager;
	}
}
